#$Id: urls.py 33061 2008-09-08 04:15:57Z jorwen@NETEASE.COM $

from django.conf.urls.defaults import *
from django.views.generic.list_detail import object_list, object_detail
from django.contrib.auth.models import User
from v4a.views import api, vote
from v4a.models import *
from v4a.config import ITEW_NUM_OF_PAGE


p = {'paginate_by':ITEW_NUM_OF_PAGE}

IMAGE_DIR = "/tmp/v4a_auth_img"

urlpatterns = patterns('',
	('^validator_image/create/$', api.get_image, {'path':IMAGE_DIR}), 
	('^validator_image/(?P<name>.*)$', api.show_image, {'path':IMAGE_DIR}), 
	('^vote_datas/(?P<vote_id>\d+)/$', api.vote_datas), 
	('^do_vote/(?P<vote_id>\d+)/$', api.do_vote), 

	('^add_vote/$', vote.add_vote), 
	('^mod_vote/(\d+)/$', vote.mod_vote), 
	('^show_vote/(?P<vote_id>\d+)/$', vote.show_vote), 
	('^vote_list/$', object_list, dict(p, queryset=Vote.objects.all(), extra_context={'plink':'/v4a/vote_list/'})), 
	('^vote_result/(\d+)/$', vote.vote_result), 
	('^vote_chart/(?P<object_id>\d+)/$', object_detail, {'queryset':Vote.objects.all(), 'template_name':'v4a/vote_chart.html'}),
	('^dump_vote_result/(\d+)/$', vote.dump_vote_result), 
	('^vote_manage/$', vote.vote_manage), 
	('^ajax_vote_page/(?P<vote_id>\d+)/$', vote.ajax_vote_page), 
	('^preview/(?P<object_id>\d+)/$', object_detail, {'queryset':Vote.objects.all(), 'extra_context':{'Q':Question, 'C':ChoiceItem}}), 

	('^add_voterinfo/$', vote.add_voterinfo), 
	('^mod_voterinfo/(\d+)/$', vote.mod_voterinfo), 
	('^del_voterinfo/(\d+)/$', vote.del_voterinfo), 
	('^voterinfo_list/$', object_list, dict(p, queryset=VoterInfo.objects.all(), extra_context={'plink':'/v4a/voterinfo_list/'})), 

	('^add_question/(\d+)/$', vote.add_question), 
	('^mod_question/(\d+)/$', vote.mod_question), 
	('^del_question/(\d+)/$', vote.del_question), 

	('^add_choiceitem/(\d+)/$', vote.add_choiceitem), 
	('^mod_choiceitem/(\d+)/$', vote.mod_choiceitem), 

	('^add_pagefile/$', vote.add_pagefile), 
	('^edit_pagefile/(?P<style_id>\d+)/$', vote.edit_pagefile), 
	('^del_pagefile/(\d+)/$', vote.del_pagefile), 

	('^add_user/$', vote.add_user), 
	('^user_list/$', object_list, dict(p, queryset=User.objects.all(), extra_context={'plink':'/v4a/user_list/'})), 
)
